﻿#include "tianditu_select.h"

int main(int argc, char **argv)
{
    if (argc != 6)
    {
        if (argc == 2 && strcmp(argv[1], "-h") == 0)
        {
            std::cout << "Usage: " << argv[0] << " <openDir> <saveDir> <cityName> <level> <tileMode>\n";
            std::cout << "\t openDir: Directory of the Tianditu dataset.\n";
            std::cout << "\t saveDir: Directory of the selected tiles should be saved.\n";
            std::cout << "\t cityName: Name of the city.\n";
            std::cout << "\t level: Level of the selected tiles.\n";
            std::cout << "\t tileMode: The mode of the selected tiles. Options: ZXY or ZYX.\n";
            std::cout << "Example: " << argv[0] << " /data/TianDiTu /data/Sichuan 四川省 14 ZXY" << std::endl;
            return 0;
        }
        else
        {
            std::cout << "Invalid argument of " << argv[0] << "\n";
            std::cout << "Run " << argv[0] << " -h for help" << std::endl;
            return -1;
        }
    }
    TianDiTuSelector tds(argv[1], argv[2], atoi(argv[4]), (argv[5] == "ZXY" ? TileMode::ZXY : TileMode::ZYX));
    tds.move(argv[3]);
    return 0;
}